package com.zys.hotel_management.service.impl;


import com.zys.hotel_management.entity.Room;
import com.zys.hotel_management.mapper.RoomMapper;
import com.zys.hotel_management.service.RoomService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class RoomServiceImpl implements RoomService {
    @Resource
    private RoomMapper roomMapper;

    @Override
    public void addRoom(Room room) {
        roomMapper.insert(room);
    }

    @Override
    public void updateRoom(Room room) {
        roomMapper.update(room);
    }

    @Override
    public void deleteRoom(Integer roomId) {
        roomMapper.delete(roomId);
    }

    @Override
    public Room getRoomById(Integer roomId) {
        return roomMapper.findById(roomId);
    }

    @Override
    public List<Room> getAllRooms() {
        return roomMapper.findAll();
    }

    @Override
    public List<Room> getAvailableRooms(String roomType) {
        return roomMapper.findAvailableRooms(roomType);
    }
}
